package edu.java.water.service.impl;

import edu.java.water.entity.UserEntity;
import edu.java.water.mapper.UserMapper;
import edu.java.water.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public UserEntity selectUserOpenId(String openId) {
        return userMapper.selectUserOpenId(openId);
    }

    @Override
    public UserEntity selectUserState(String openId, String state) {
        return  userMapper.selectUserState(openId,state);
    }

    @Override
    public boolean InsertUser(String openId, String username) {
        int row = userMapper.InsertUser(openId,username);
        if(row>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean setUserData(UserEntity userEntity) {
        int row=userMapper.setUserData(userEntity);
        if(row>0){
            return true;
        }
        return false;
    }
}
